package com.enation.app.javashop.core.client.fallback.goods;

import com.enation.app.javashop.core.client.feignimpl.goods.SearchKeywordClientFeignImpl;
import com.enation.app.javashop.core.handler.BaseFallbackFactory;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Component;

/**
 * 商品分词熔断 fallback factory
 * @author kingapex
 * @version 1.0
 * @data 2022/5/28 14:18
 **/
@Component
public class SearchKeywordClientFallbackFactory extends BaseFallbackFactory<SearchKeywordClientFeignImpl> {
    @Override
    protected SearchKeywordClientFeignImpl fallback() {
        return new SearchKeywordClientFallback();
    }

    /**
     * 商品分词熔断
     *
     * @author zh
     * @version v7.0
     * @date 18/9/27 下午3:15
     * @since v7.0
     */
    @Component
    public static class SearchKeywordClientFallback implements SearchKeywordClientFeignImpl {

        private final Logger logger = LoggerFactory.getLogger(getClass());


        @Override
        public void add(String keyword) {
            logger.error("添加关键词出错，关键词："+keyword);
        }

        @Override
        public void update(String keyword) {
            logger.error("修改关键词出错，关键词："+keyword);
        }

        @Override
        public boolean isExist(String keyword) {
            logger.error("判断关键词是否存在出错，关键词："+keyword);
            return false;
        }
    }
}
